<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ include file="/common/taglibs.jsp"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>My JSP 'editSysRole.jsp' starting page</title>

<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">

<link rel="shortcut icon" href="${ctx }/ico/favicon.ico">
<link href="${ctx }/css/bootstrap.min.css?v=3.3.6" rel="stylesheet">
<link href="${ctx }/css/font-awesome.css?v=4.4.0" rel="stylesheet">

<!-- jqgrid-->
<link href="${ctx }/css/plugins/jqgrid/ui.jqgrid.css?0820"
	rel="stylesheet">

<link href="${ctx }/css/plugins/jsTree/style.min.css" rel="stylesheet">

<link href="${ctx }/css/animate.css" rel="stylesheet">
<link href="${ctx }/css/common.css" rel="stylesheet">
<link href="${ctx }/css/style.css"  rel="stylesheet">
<!--bootstrap-select-->
<link
	href="${ctx}/css/plugins/bootstrap-select/bootstrap-select.min.css"
	rel="stylesheet" />
<style>
	body {
		background: none;
	}
</style>
</head>

<body>
	<div class="inmodal" role="dialog" aria-labelledby="myModalLabel"
		aria-hidden="true">
		<div class="modal-dialog">
			<div class="modal-content animated bounceInRight">
				<div class="modal-header">
					<button type="button" class="close closeWin" data-dismiss="modal">
						<span aria-hidden="true">&times;</span><span class="sr-only">关闭</span>
					</button>
					<h4 class="modal-title">修改角色</h4>
				</div>
				<div class="ibox-content">
					<form class="form-horizontal m-t" id="editSysRoleForm">
						<input name="id" type="hidden" value="${role.id }">

						<div class="form-group">
							<label class="col-sm-3 control-label">角色名称：</label>
							<div class="col-sm-8">
								<input id="sysRoleName" name="name" class="form-control"
									required="" aria-required="true" type="text"
									value="${role.name }" placeholder="请输角色名称">
							</div>
						</div>

						<div class="form-group">
							<label class="col-sm-3 control-label">角色标识：</label>
							<div class="col-sm-8">
								<input id="roleKey" name="roleKey" class="form-control"
									required="" aria-required="true" type="text"
									value="${role.roleKey }" placeholder="请输角色标识">
							</div>
						</div>

						<div class="form-group">
							<label class="col-sm-3 control-label">角色描述：</label>
							<div class="col-sm-8">
								<input id="description" name="description" class="form-control"
									required="" aria-required="true" type="text"
									value="${role.description }" placeholder="请输角色描述">
							</div>
						</div>
						<div class="form-group">
							<label class="col-sm-3 control-label">角色等级：</label>
							<div class="col-sm-8">
								<select class="selectpicker" required="" aria-required="true"
									name="role_level" id="role_level">
									<option value="0" <c:if test="${role.role_level==0}">selected</c:if>>系统管理员</option>
									<option value="1" <c:if test="${role.role_level==1}">selected</c:if>>
										省级管理员</option>
									<option value="2" <c:if test="${role.role_level==2}">selected</c:if>>
										省级操作员</option>
									<option value="3" <c:if test="${role.role_level==3}">selected</c:if>>
										市州管理员</option>
									<option value="4" <c:if test="${role.role_level==4}">selected</c:if>>市州操作员</option>
								</select>
							</div>
						</div>
						<div class="form-group">
							<div class="col-sm-8 col-sm-offset-3">
								<button type="button" class="btn btn-white closeWin">关闭</button>
								<button type="submit" class="btn btn-primary">保存</button>
							</div>
						</div>
					</form>
				</div>
			</div>
		</div>
	</div>
	<!-- 全局js -->
	<script src="${ctx }/js/jquery.min.js?v=2.1.4"></script>
	<script src="${ctx }/js/bootstrap.min.js?v=3.3.6"></script>
	<!-- Peity -->
	<script src="${ctx }/js/plugins/peity/jquery.peity.min.js"></script>
	<!-- jqGrid -->
	<script src="${ctx }/js/plugins/jqgrid/i18n/grid.locale-cn.js?0820"></script>
	<script src="${ctx }/js/plugins/jqgrid/jquery.jqGrid.min.js?0820"></script>
	<!-- jQuery Validation plugin javascript-->
	<script src="${ctx }/js/plugins/validate/jquery.validate.min.js"></script>
	<script src="${ctx }/js/plugins/validate/messages_zh.min.js"></script>
	<!-- layer javascript -->
	<script src="${ctx }/js/plugins/layer/layer.min.js"></script>
	<!-- jQuery form-->
	<script src="${ctx }/js/jquery.form.js"></script>
	<!-- 自定义js -->
	<script src="${ctx }/js/content.js?v=1.0.0"></script>
	<!--bootstrap-select-->
	<script
		src="${ctx}/js/plugins/bootstrap-select/bootstrap-select.min.js"></script>

	<script type="text/javascript">
		$(document).ready(function() {
			$.jgrid.defaults.styleUI = 'Bootstrap';

			//绑定add表单提交事件,异步提交表单
			$('#editSysRoleForm').submit(function() {
				$.ajax({
					type : "post",
					url : "${ctx }/security/role/doEditRole",
					data : $('#editSysRoleForm').serialize(),
					success : function(data) {
						if (data.errcode == "0") {
							layer.alert(data.errmsg, {
								icon : 1
							}, function(index) {
								//刷新表格数据
								window.parent.editWinClose('0');
								//关闭提示框
								layer.close(index);
							});
						} else {
							layer.alert(data.errmsg, {
								icon : 2
							});
						}
					},
					error : function() {
						layer.alert('添加角色失败！', {
							icon : 2
						});
					}
				});
				return false;
			});

			$('.closeWin').click(function() {
				window.parent.editWinClose('1');
			});

		});
	</script>
</body>
</html>
